package com.base.action;

import java.util.List;

import com.base.service.CardTypeService;
import com.base.service.DictService;
import com.base.service.FlowtemplatebranchService;
import com.base.service.FlowtemplatedetailService;
import com.base.service.RuleService;
import com.common.bean.Cardsubtype;
import com.common.bean.Datadict;
import com.common.bean.Flowtemplatebranch;
import com.common.bean.Flowtemplatedetail;
import com.common.bean.Rule;
import com.common.util.PagerModel;
import com.common.util.StringToken;
import com.core.ssh2.AbstractActionSupport;
import com.opensymphony.xwork2.Preparable;

public class FlowtemplatebranchManagerAction extends AbstractActionSupport
		implements Preparable {
	private static final long serialVersionUID = -3466023936913707911L;

	private FlowtemplatebranchService flowtemplatebranchService;
	
	private FlowtemplatedetailService flowtemplatedetailService;
	
	private RuleService ruleService;
	
	private CardTypeService cardTypeService;
	
	private DictService dictService;
	
	private Flowtemplatebranch flowtemplatebranch;
	
	private long branchid;
	
	private PagerModel pm;
	
	private Flowtemplatedetail flowtemplatedetail;
	
	private List<Rule> rulelist;
	
	private List<Flowtemplatedetail> flowtemplatedetaillist;
	
	private List<Cardsubtype> cardsubtypelist;
	
	private List<Datadict> datadictlist;

	@SuppressWarnings("unchecked")
	public void prepare() throws Exception {
		rulelist = ruleService.findAllRule();
		flowtemplatedetaillist = flowtemplatedetailService.findAllFlowtemplatedetail();//根据模版筛选步骤列表
		cardsubtypelist = cardTypeService.findAllCardsubtype();
		datadictlist = dictService.findDictDetail(StringToken.DICT_FLOWBRANCHSTATUS);//流程步骤状态
	}
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String goAddFlowtemplatebranch() throws Exception {
		//need a object of Flowtemplatedetail
		return SUCCESS;
	}

	public String addFlowtempaltebranch() throws Exception {
		flowtemplatebranchService.addFlowtemplatebranch(flowtemplatebranch);
		return SUCCESS;
	}
	
	public String findAllFlowtemplatebranch() throws Exception {
		pm = flowtemplatebranchService.findFlowtemplatebranchForPager();
		return SUCCESS;
	}
	
	public String findFlowtemplatebranch() throws Exception {
		flowtemplatebranch = flowtemplatebranchService.findFlowtemplatebranch(branchid);
		return SUCCESS;
	}
	
	public String delFlowtemplatebranch() throws Exception {
		flowtemplatebranchService.removeFlowtemplatebranch(branchid);
		return SUCCESS;
	}
	
	public String getFlowtemplatebranchForUpdate() throws Exception {
		flowtemplatebranch = flowtemplatebranchService.findFlowtemplatebranch(branchid);
		return SUCCESS;
	}
	
	public String updateFlowtemplatebranch() throws Exception {
		flowtemplatebranchService.updataFlowtemplatebranch(flowtemplatebranch);
		return SUCCESS;
	}

	/**
	 * @return the branchid
	 */
	public long getBranchid() {
		return branchid;
	}

	/**
	 * @param branchid the branchid to set
	 */
	public void setBranchid(long branchid) {
		this.branchid = branchid;
	}

	/**
	 * @return the cardsubtypelist
	 */
	public List<Cardsubtype> getCardsubtypelist() {
		return cardsubtypelist;
	}

	/**
	 * @param cardsubtypelist the cardsubtypelist to set
	 */
	public void setCardsubtypelist(List<Cardsubtype> cardsubtypelist) {
		this.cardsubtypelist = cardsubtypelist;
	}

	/**
	 * @return the cardTypeService
	 */
	public CardTypeService getCardTypeService() {
		return cardTypeService;
	}

	/**
	 * @param cardTypeService the cardTypeService to set
	 */
	public void setCardTypeService(CardTypeService cardTypeService) {
		this.cardTypeService = cardTypeService;
	}

	/**
	 * @return the datadictlist
	 */
	public List<Datadict> getDatadictlist() {
		return datadictlist;
	}

	/**
	 * @param datadictlist the datadictlist to set
	 */
	public void setDatadictlist(List<Datadict> datadictlist) {
		this.datadictlist = datadictlist;
	}

	/**
	 * @return the dictService
	 */
	public DictService getDictService() {
		return dictService;
	}

	/**
	 * @param dictService the dictService to set
	 */
	public void setDictService(DictService dictService) {
		this.dictService = dictService;
	}

	/**
	 * @return the flowtemplatebranch
	 */
	public Flowtemplatebranch getFlowtemplatebranch() {
		return flowtemplatebranch;
	}

	/**
	 * @param flowtemplatebranch the flowtemplatebranch to set
	 */
	public void setFlowtemplatebranch(Flowtemplatebranch flowtemplatebranch) {
		this.flowtemplatebranch = flowtemplatebranch;
	}

	/**
	 * @return the flowtemplatebranchService
	 */
	public FlowtemplatebranchService getFlowtemplatebranchService() {
		return flowtemplatebranchService;
	}

	/**
	 * @param flowtemplatebranchService the flowtemplatebranchService to set
	 */
	public void setFlowtemplatebranchService(
			FlowtemplatebranchService flowtemplatebranchService) {
		this.flowtemplatebranchService = flowtemplatebranchService;
	}

	/**
	 * @return the flowtemplatedetaillist
	 */
	public List<Flowtemplatedetail> getFlowtemplatedetaillist() {
		return flowtemplatedetaillist;
	}

	/**
	 * @param flowtemplatedetaillist the flowtemplatedetaillist to set
	 */
	public void setFlowtemplatedetaillist(
			List<Flowtemplatedetail> flowtemplatedetaillist) {
		this.flowtemplatedetaillist = flowtemplatedetaillist;
	}

	/**
	 * @return the flowtemplatedetailService
	 */
	public FlowtemplatedetailService getFlowtemplatedetailService() {
		return flowtemplatedetailService;
	}

	/**
	 * @param flowtemplatedetailService the flowtemplatedetailService to set
	 */
	public void setFlowtemplatedetailService(
			FlowtemplatedetailService flowtemplatedetailService) {
		this.flowtemplatedetailService = flowtemplatedetailService;
	}

	/**
	 * @return the pm
	 */
	public PagerModel getPm() {
		return pm;
	}

	/**
	 * @param pm the pm to set
	 */
	public void setPm(PagerModel pm) {
		this.pm = pm;
	}

	/**
	 * @return the rulelist
	 */
	public List<Rule> getRulelist() {
		return rulelist;
	}

	/**
	 * @param rulelist the rulelist to set
	 */
	public void setRulelist(List<Rule> rulelist) {
		this.rulelist = rulelist;
	}

	/**
	 * @return the ruleService
	 */
	public RuleService getRuleService() {
		return ruleService;
	}

	/**
	 * @param ruleService the ruleService to set
	 */
	public void setRuleService(RuleService ruleService) {
		this.ruleService = ruleService;
	}

	/**
	 * @return the flowtemplatedetail
	 */
	public Flowtemplatedetail getFlowtemplatedetail() {
		return flowtemplatedetail;
	}

	/**
	 * @param flowtemplatedetail the flowtemplatedetail to set
	 */
	public void setFlowtemplatedetail(Flowtemplatedetail flowtemplatedetail) {
		this.flowtemplatedetail = flowtemplatedetail;
	}
	
}
